package com.wdc.dp;

public class E02Leetcode70 {
    public int climbStairs(int n){
        if (n == 1) {
            return 1;
        }
        if (n == 2) {
            return 2;
        }
        int[] dp = new int[n ];
        dp[0] = 1;
        dp[1] = 2;
        for (int i = 2; i < dp.length; i++) {
            dp[i] = dp[i - 1] + dp[i - 2];
        }

        return dp[dp.length - 1];
    }

    public static void main(String[] args) {
        E02Leetcode70 e02Leetcode70 = new E02Leetcode70();
        System.out.println(e02Leetcode70.climbStairs(3));
    }
}
